package com.ctshk.rpc.season.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ctshk.common.enums.IsDeletedCode;
import com.ctshk.common.utils.EntityUtil;
import com.ctshk.rpc.season.dto.SeasonProOfflineAgentCustomDTO;
import com.ctshk.rpc.season.dto.SeasonProductChannelOfflineAgentCustomArrayDTO;
import com.ctshk.rpc.season.entity.SeasonProductChannelOfflineAgentCustom;
import com.ctshk.rpc.season.mapper.SeasonProductChannelOfflineAgentCustomMapper;
import com.ctshk.rpc.season.service.ISeasonProductChannelOfflineAgentCustomService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * <p>
 * 套票线下代理商自定义权限 服务实现类
 * </p>
 *
 * @author 杨林
 * @since 2021-03-15
 */
@DubboService
public class SeasonProductChannelOfflineAgentCustomServiceImpl extends ServiceImpl<SeasonProductChannelOfflineAgentCustomMapper, SeasonProductChannelOfflineAgentCustom> implements ISeasonProductChannelOfflineAgentCustomService {

    @Autowired
    private SeasonProductChannelOfflineAgentCustomMapper agentCustomMapper;


    @Override
    public List<SeasonProductChannelOfflineAgentCustomArrayDTO> getAgentByOfflineId(Long offlineId) {
        List<SeasonProductChannelOfflineAgentCustom> list = agentCustomMapper.selectList(
                new QueryWrapper<SeasonProductChannelOfflineAgentCustom>().lambda()
                        .eq(SeasonProductChannelOfflineAgentCustom::getOfflineId, offlineId)
                        .eq(SeasonProductChannelOfflineAgentCustom::getIsDeleted, IsDeletedCode.NO.getCode())
        );

        return EntityUtil.copyList(list, SeasonProductChannelOfflineAgentCustomArrayDTO.class);
    }

    public SeasonProOfflineAgentCustomDTO queryAgent(Long fixedSeasonId) {
        return agentCustomMapper.queryAgent(fixedSeasonId);
    }

}
